import 'package:flutter/material.dart';
import '../../utils/base.dart';

class CoinSellerList extends StatelessWidget {
  const CoinSellerList({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
        // height: 300,
        child: GridView.count(
      physics: const NeverScrollableScrollPhysics(),
      //ListView嵌套GridView会报错，加此参数后可修正错误： https://segmentfault.com/q/1010000018145105/
      shrinkWrap: true,
      //每行3个
      crossAxisCount: 3,
      //水平子Widget之间间距
      crossAxisSpacing: Design.px(20),
      //垂直子Widget之间间距
      mainAxisSpacing: Design.px(20),
      // 中间间隔空白比例  https://blog.csdn.net/hao_m582/article/details/84108041
      childAspectRatio: 3 / 1,
      padding: EdgeInsets.all(Design.px(20)),

      children: [1, 5, 10, 25, 50, 0].map((index) {
        return CoinSellerItem(index);
      }).toList(),
    ));
  }
}

class CoinSellerItem extends StatelessWidget {
  final int num;
  const CoinSellerItem(this.num, {Key key}) : super(key: key);

  TextStyle styleTitle() {
    return TextStyle(
        fontSize: Design.px(50),
        color: HexColor("333333"),
        decoration: TextDecoration.none);
  }

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
          height: Design.px(173),
          width: Design.px(565),
          decoration: BoxDecoration(
            boxShadow: [
              new BoxShadow(
                  color: HexColor("f1f1f1"),
                  offset: new Offset(Design.px(10), Design.px(10)),
                  blurRadius: Design.px(10),
                  spreadRadius: Design.px(2))
              // BoxShadow(color: Color(0x99FFFF00), offset: Offset(5.0, 5.0),    blurRadius: 10.0, spreadRadius: 2.0),
              // BoxShadow(color: Color(0x9900FF00), offset: Offset(1.0, 1.0)),
              // BoxShadow(color: Color(0xFF0000FF))
            ],
          ),
          child: FlatButton(
              color: HexColor('FFFFFF'),
              shape: new RoundedRectangleBorder(
                  borderRadius: new BorderRadius.circular(Design.px(17))),
              child: Text(
                '${num > 0 ? num : '其他数量'}币',
                style: styleTitle(),
              ),
              onPressed: () => {})),
    );
  }
}
